/*
 * @Author: your name
 * @Date: 2021-05-12 19:59:05
 * @LastEditTime: 2021-05-12 21:05:52
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \blog-server\plugins\db.js
 */
const mongoose = require('mongoose')
mongoose.connect('mongodb://127.0.0.1:27017/db_blog', { useNewUrlParser: true, useUnifiedTopology: true })
let db = mongoose.connection
db.on('error', function (err) {
  console.log(err)
})
db.on('open', function (err) {
  console.dir('mongodb://127.0.0.1:27017/db_blog is open')
})

module.exports = {
  mongoose
}